
import * as cc from "cc";
import { resourcesMgr } from "../../framework/loader/ResourcesMgr";
import { UIWindowBase } from "../../framework/ui/UIWindowBase";
import { Locator } from "../../framework/utils/Locator";
import { VMCenter } from "../../framework/vm/VMCenter";
import { VMEntity } from "../../framework/vm/VMEntity";
import { UIBaseTest } from "./UIBaseTest";
import { UIWindowBaseTest } from "./UIWindowBaseTest";
const { ccclass } = cc._decorator;

/**
 * Predefined variables
 * Name = RenameWindowTest
 * DateTime = Sun Mar 20 2022 19:33:14 GMT+0800 (中国标准时间)
 * Author = 272493431
 * FileBasename = RenameWindowTest.ts
 * FileBasenameNoExtension = RenameWindowTest
 * URL = db://assets/scripts/scene/Test/RenameWindowTest.ts
 * ManualUrl = https://docs.cocos.com/creator/3.4/manual/zh/
 *
 */

 let idx = 0;
@ccclass('RenameWindowTest')
export class RenameWindowTest extends UIWindowBaseTest implements IMVVM{
    uuid = `UIBase_${idx++}`;

    _vmTag: string;
    _vmEntitys: VMEntity[];
    node: cc.Node;
    constructor() {
        super();
        this.onCtor("prefabs/RenameWindow");
    }
   

    intervalTimer;
    onLoaded(): void {
        let self = this;
        VMCenter.VMTag(this);

        this.registeButtonClick(">buttonCancel", () => {
            self.close();
        })


        this.intervalTimer = setInterval(() => {
            console.log(`RenameWindowTest-> `, this._vmTag, this.uuid);
        }, 1000);
        console.log(`RenameWindowTest->onLoaded intervalTimer: `,this.intervalTimer);
        
    }

    onUnloaded(): void {

        console.log(`RenameWindowTest->onUnloaded intervalTimer: `,this.intervalTimer);
        clearInterval(this.intervalTimer);

    }

    

    close(){
        this.onUnloaded();
        this.node.destroy();
    }

}
